<%@ Page Language="C#" MasterPageFile="~/Admin/admin.master" AutoEventWireup="true"
    CodeFile="CheckInvoice.aspx.cs" Inherits="Admin_CheckInvoice" Title="Check Invoice List" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder2" runat="Server">
    Check Invoice List</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">

    <script>
        function pageLoad() {
            $('#<%=tb_InvoiceNumber.ClientID %>').focus();
        }

    </script>

    <asp:ScriptManager ID="ScriptManager1" runat="server">
    </asp:ScriptManager>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>
            <asp:Panel runat="server" ID="pn_Add" DefaultButton="btn_Receive">
                <table>
                    <tr>
                        <td>
                            Invoice Number:
                        </td>
                        <td>
                            <div>
                                <asp:TextBox ID="tb_InvoiceNumber" CssClass="text-input" runat="server" onFocus="javascript:this.select()"></asp:TextBox>
                            </div>
                        </td>
                        <td>
                            <asp:Button ID="btn_Receive" runat="server" Text="Check" CssClass="button" OnClick="btn_Receive_Click" />
                            <asp:Button ID="btn_Print" runat="server" Text="Print" CssClass="button" OnClick="btn_Print_Click" />
                        </td>
                    </tr>
                    <tr>
                        <td>
                        </td>
                        <td>
                        </td>
                        <td>
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <h3>
                Checked Invoices</h3>
            <data:EntityGridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID=""
                AllowMultiColumnSorting="False" DefaultSortColumnName="ReceivedDate" DefaultSortDirection="Descending"
                AllowPaging="True" ExcelExportFileName="Export_CheckInvoice.xls" AllowExportToExcel="True"
                AllowSorting="True" ExportToExcelText="Excel" PageSelectorPageSizeInterval="10"
                RecordsCount="0" ShowGridOnEmptyData="False" OnRowCommand="GridView1_RowCommand">
                <Columns>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton3" runat="server" CausesValidation="True" CommandName="RemoveInvoice"
                                CommandArgument='<%#Bind("VatInvoiceNumber") %>' Text="Remove"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField ShowHeader="False">
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="True" CommandName="UpdatePaymentMode"
                                CommandArgument='<%#Bind("VatInvoiceNumber") %>' Text="Update"></asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="RevisePaymentMode" SortExpression="PaymentModeRevised">
                        <ItemTemplate>
                            <data:EntityDropDownList ID="ddl_RevisePaymentMode" runat="server" SelectedValue='<%# Bind("PaymentModeRevised") %>'
                                DataSourceID="AbAccCodeDataSource1" DataValueField="KindPment" DataTextField="KindPment"
                                AppendNullItem="True" NullItemText="" />
                            <data:AbAccountCodeDataSource runat="server" ID="AbAccCodeDataSource1" SelectMethod="GetAll">
                            </data:AbAccountCodeDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Void Type" SortExpression="VoidType">
                        <ItemTemplate>
                            <data:EntityDropDownList ID="ddl_VoidType" runat="server" SelectedValue='<%# Bind("VoidType") %>'
                                DataSourceID="VoidReasonDataSource1" DataValueField="VoidDesc" DataTextField="VoidDesc"
                                AppendNullItem="True" NullItemText="" />
                            <data:VoidReasonDataSource ID="VoidReasonDataSource1" runat="server" SelectMethod="GetAll">
                            </data:VoidReasonDataSource>
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField HeaderText="Remark" SortExpression="Remark">
                        <ItemTemplate>
                            <asp:TextBox runat="server" Width="150px" ID="tb_Remark" CssClass="text-input" Text='<%#Bind("Remark") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                    <asp:BoundField DataField="VatInvoiceNumber" HeaderText="VatInvoiceNumber" SortExpression="VatInvoiceNumber" />
                    <asp:BoundField DataField="DateVisit" HeaderText="DateVisit" SortExpression="DateVisit" />
                    <asp:BoundField DataField="PatientCode" HeaderText="PatientCode" SortExpression="PatientCode" />
                    <asp:BoundField DataField="PatientName" HeaderText="PatientName" SortExpression="PatientName" />
                    <asp:BoundField DataField="PaymentMode" HeaderText="PaymentMode" SortExpression="PaymentMode" />
                    <asp:BoundField DataField="UpdPaymentDate" HeaderText="UpdPaymentDate" SortExpression="UpdPaymentDate" />
                    <asp:BoundField DataField="TotalProcedure" HeaderText="TotalProcedure" SortExpression="TotalProcedure" />
                    <asp:BoundField DataField="TotalPharmacy" HeaderText="TotalPharmacy" SortExpression="TotalPharmacy" />
                    <asp:BoundField DataField="TotalAmountVnd" HeaderText="TotalAmountVnd" SortExpression="TotalAmountVnd" />
                    <asp:BoundField DataField="TotalAmountUsd" HeaderText="TotalAmountUsd" SortExpression="TotalAmountUsd"
                        DataFormatString="{0:##0.00}" />
                    <asp:BoundField DataField="ExchangeRate" HeaderText="ExchangeRate" SortExpression="ExchangeRate" />
                    <asp:BoundField DataField="SunImportDate" HeaderText="SunImportDate" SortExpression="SunImportDate" />
                    <asp:CheckBoxField DataField="Received" HeaderText="Received" SortExpression="Received" />
                    <asp:BoundField DataField="ReceivedDate" HeaderText="ReceivedDate" SortExpression="ReceivedDate" />
                </Columns>
                <EmptyDataTemplate>
                    <b>No Checked Invoices Found!</b>
                </EmptyDataTemplate>
            </data:EntityGridView>
            <br />
            <%--<data:AllInvoiceDataSource ID="AllInvoiceDataSource" runat="server" SelectMethod="GetPaged"
                EnablePaging="True" EnableSorting="True">
                <Parameters>
                    <data:CustomParameter Name="WhereClause" Value="Received=1 AND DATEDIFF(d,ReceivedDate,GETDATE())=0"
                        ConvertEmptyStringToNull="false" />
                    <data:CustomParameter Name="OrderByClause" Value="ReceivedDate DESC" ConvertEmptyStringToNull="false" />
                    <asp:ControlParameter Name="PageIndex" ControlID="GridView1" PropertyName="PageIndex"
                        Type="Int32" />
                    <asp:ControlParameter Name="PageSize" ControlID="GridView1" PropertyName="PageSize"
                        Type="Int32" />
                    <data:CustomParameter Name="RecordCount" Value="0" Type="Int32" />
                </Parameters>
            </data:AllInvoiceDataSource>--%>
        </ContentTemplate>
    </asp:UpdatePanel>
</asp:Content>
